package cn.edu.service.impl;

import cn.edu.dao.lead_InfomationDao;
import cn.edu.domain.PieData;
import cn.edu.service.lead_InfomationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Davey chan
 */
@Service
public  class lead_InfomationServiceImpl implements lead_InfomationService {
    @Autowired
 private lead_InfomationDao infomationDao;
    @Override
    public List<PieData> getpie(String academyName, String departmentName) {

        List<PieData> pieData=new ArrayList<>();
        PieData a=new PieData();
        int num1=infomationDao.GetprofessorNum(academyName,departmentName);
        a.setValue(num1);
        a.setName("教授");
        pieData.add(a);
        PieData b=new PieData();
        int num2=infomationDao.GetAsprofessorNum(academyName,departmentName);
        b.setValue(num2);
        b.setName("副教授");
        pieData.add(b);
        PieData c=new PieData();
        int num3=infomationDao.GetLecturerNum(academyName,departmentName);
        c.setValue(num3);
        c.setName("讲师");
        pieData.add(c);
        return pieData;
    }

    @Override
    public List<Integer> getBar(String academyName, String departmentName,String year) {
        List<Integer> barData=new ArrayList<>();
        int a=infomationDao.GetOpsNum(academyName,departmentName,year);
        int b=infomationDao.GetPatentNum(academyName,departmentName,year);
        int d=infomationDao.GetthesisNum(academyName,departmentName,year);
        int c=infomationDao.Getresearch_projectNum(academyName,departmentName,year);
       barData.add(a);
       barData.add(b);
       barData.add(d);
        barData.add(c);
        return barData;
    }

    @Override
    public List getBar1() {
        List<Integer> barData=new ArrayList<>();
        int e=infomationDao.GetExcellent();
        int f=infomationDao.GetGood();
        int g=infomationDao.GetNormal();
        barData.add(e);
        barData.add(f);
        barData.add(g);

        return barData;
    }


    @Override
    public List<PieData> getAward(String academyName,String departmentName,String year) {
        String y="%"+year+"%";
        return infomationDao.GetAward(academyName,departmentName,y);
    }
    @Override
    public List getExamine(String academyName,String department) {
        return infomationDao.GetExamine(academyName,department);
    }
}
